<script setup name="SyPairCodeFormNew">
import { ref,onMounted } from "vue";
import FyDl from "./viewSon/fydl.vue";
import BuMen from "./viewSon/bumen.vue";
import GhLb from "./viewSon/ghlb.vue";
import FkFs from "./viewSon/fkfs.vue";
import YpClDyDm from "./viewSon/ypclsydm.vue";
import JxDmB from "./viewSon/jxdmb.vue";
import FyYf from "./viewSon/fyyf.vue";
import YyCs from "./viewSon/yycs.vue";
import YlWsJgXxZc from "./viewSon/ylwsjgxxzc.vue";
import YlWsRyZc from "./viewSon/ylwsryzc.vue";
import YlKsXxZc from "./viewSon/ylksxxzc.vue";
import CwXxSc from "./viewSon/cwxxsc.vue";



import {selectData1,saveData1,dataSourceTableConst,
        insertFun,tableRef,updateFun,cellClick,
        cellClickConst,deleteFun} 
from "@/utils/InsertDeleteSelectUpdate";


const select1=()=>{
    selectData1('100150',{"vlb":buttonVlbConst.value},"zyhttphosptalserver");
}
const insert1=()=>{

  const insertObj={
  dybl:"1",
  dybl1:"77",
  dydw:"77",
  dydw1:"77",
  dyz:"123",
  hisbm:"人",
  hisdw:"77",
  hismc:"77",
  jm:"",
  lb:"1",
  saveflag: 1 
};
   
  insertObj.lb=buttonVlbConst.value;
  insertFun(insertObj,'jm');
}
const update1=(row ,i)=>{
    updateFun(row,i)
}
const save1=()=>{
    saveData1('100151','zyhttphosptalserver');
    select1();
}
const delete1=()=>{
    deleteFun();
}


//根据点击的菜单列表获取对应的数据源信息，以下是类别信息和获取方法
const buttonVlbConst=ref('1');
//定义左侧列表样式切换的方法就是改选中颜色和字体颜色的方法和变量
const buttonConst=ref('呼吸机');
const buttonConstListCss=ref([
  {a:"#359DE1",b:"#FFFFFF",c:"部门",d:true} ,
  {a:"#fff",b:"#333333",c:"挂号类别",d:false} ,
  {a:"#fff",b:"#333333",c:"财务分类",d:false} ,
  {a:"#fff",b:"#333333",c:"付款方式",d:false} ,
  {a:"#fff",b:"#333333",c:"用药次数",d:false} ,
  {a:"#fff",b:"#333333",c:"服药用法",d:false} ,
  {a:"#fff",b:"#333333",c:"剂型代码表",d:false} ,
  {a:"#fff",b:"#333333",c:"药品材料三医对码",d:false} ,
  {a:"#fff",b:"#333333",c:"医疗卫生机构信息注册",d:false} ,
  {a:"#fff",b:"#333333",c:"医疗卫生人员注册",d:false} ,
  {a:"#fff",b:"#333333",c:"医疗科室信息注册",d:false} ,
  {a:"#fff",b:"#333333",c:"床位信息上传",d:false}
]);

const buttonConstFun=(buttonValue)=>{
    for(var i=0;i<buttonConstListCss.value.length;i++){
        buttonConst.value=buttonValue;
        if(buttonValue==buttonConstListCss.value[i].c){
            buttonConstListCss.value[i].a="#359DE1"; 
            buttonConstListCss.value[i].b="#FFFFFF";
            buttonConstListCss.value[i].d=true;
        }
        else{
            buttonConstListCss.value[i].a="#fff"; 
            buttonConstListCss.value[i].b="#333333";
            buttonConstListCss.value[i].d=false;
        }
    }
}
//2.0把标识列的数字转码成删除、修改、新增等文字
const biaoshi = (cellValue ) => {
    if(cellValue=='2')
    {
     return   '待改'
    }
    else if(cellValue=='1')
    {
     return  '待增'
    }
    else if(cellValue=='3')
    {
     return  '待删'
    }
    else if(cellValue=='9')
    {
     return  '待删'
    }
    else
    {
     return ''
    }  
}

onMounted(()=>{
    select1();
});
</script>

<template>
<!-- 最外层灰色内边距8px盒子 -->
<div class="main-content">
    <!-- 次外层白色内边距12px盒子 -->
    <div class="main-content-case">
        <!-- 左侧菜单盒子 -->
        <div class="main-content-left">
            <!-- 循环生成每行菜单 -->
            <div v-for="item in buttonConstListCss" 
                 class="main-content-left-button xpFont" 
                   :style="{background:item.a,color:item.b}" 
                   @click="buttonConstFun(item.c)">
                <img src="@/assets/images/file_icon.png" style="width: 16px;height: 16px;margin-right: 5px;"></img>
                <div>{{item.c}}</div>
            </div>
        </div>  
        <!-- 右侧内容盒子 -->
        <div  class="main-content-right">
            <!--标题盒子20px -->
            <div class="main-content-right-title">
                 {{buttonConst}}
            </div>
            <div class="main-content-content">
                <BuMen v-if=buttonConstListCss[0].d></BuMen>
                <GhLb v-if=buttonConstListCss[1].d></GhLb>   
                <FyDl  v-if=buttonConstListCss[2].d></FyDl>   
                <FkFs  v-if=buttonConstListCss[3].d></FkFs>     
                <YyCs v-if=buttonConstListCss[4].d></YyCs>
                <FyYf v-if=buttonConstListCss[5].d></FyYf>   
                <JxDmB  v-if=buttonConstListCss[6].d></JxDmB>   
                <YpClDyDm  v-if=buttonConstListCss[7].d></YpClDyDm>  
                <YlWsJgXxZc  v-if=buttonConstListCss[8].d></YlWsJgXxZc> 
                <YlWsRyZc  v-if=buttonConstListCss[9].d></YlWsRyZc> 
                <YlKsXxZc  v-if=buttonConstListCss[10].d></YlKsXxZc> 
                <CwXxSc  v-if=buttonConstListCss[11].d></CwXxSc> 

                

  
            </div>


        </div>
        
    </div>
</div>


</template>

<style lang="scss" scoped>
 
.main-content{
  padding: 8px;
  box-sizing: border-box;
  width: 100%;
  height: calc(100vh - 83px);
  background: #f7f7f7;

  .main-content-case{
    width: 100%;
    height: 100%;
    background:#fff;
    padding: 12px;
    box-sizing: border-box;
    border-radius: 4px 4px 4px 4px;
    display: flex;
    //左侧菜单盒子
    .main-content-left{
        width: 192px;
        height: 100%;
        
        .main-content-left-button{
            height: 36px;
            width: 100% ;
            padding: 8px;
            display: flex;
            align-items: center;
            border-radius: 4px 4px 4px 4px;
            cursor: pointer; /* 这里设置为pointer，即手指形状 */
        }
    }
    //右侧内容盒子
    .main-content-right{
        width: calc(100% - 193px);
        height: 100%;
        border-left: 1px solid  #EBEBEB;
        padding-left: 12px;
        // background-color: aqua;
        // 标题盒子20px
        .main-content-right-title{
            height: 20px;
            font-family: Microsoft YaHei, Microsoft YaHei;
            font-weight: bold;
            font-size: 14px;
            color: #333333;
            line-height: 20px;
            text-align: left;
            font-style: normal;
            text-transform: none;
        } 
        //右侧嵌入子页面盒子52px
        .main-content-content{
            height: calc(100% - 20px);
            width: 100%;  
            
        }
    }
  }
}
.xpFont{
  font-family: Microsoft YaHei, Microsoft YaHei;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  font-style: normal;
  text-transform: none;
}
.xpFontText-align{
  text-align: left;
}
.xpFontColor{
    color: #333333;
}
</style>